﻿namespace FSpec

module Operators =
    
    let (&=) lhs rhs =
        verify(fun()-> 
            if lhs |> equals rhs then 
                null
            else
                createFailureFrom "LHS should equal RHS."
                |> addLabelledValues ("LHS", lhs)("RHS", rhs)
                |> toFailureException
        )
        
    let (&>) lhs rhs =
        verify(fun()-> 
            if lhs |> isGreaterThan rhs then 
                null
            else
                createFailureFrom "LHS should be greater than RHS."
                |> addLabelledValues ("LHS", lhs)("RHS", rhs)
                |> toFailureException
        )

    let (&>=) lhs rhs =
        verify(fun()-> 
            if lhs |> isGreaterThanOrEqualTo rhs then 
                null
            else
                createFailureFrom "LHS should be greater than or equal to RHS."
                |> addLabelledValues ("LHS", lhs)("RHS", rhs)
                |> toFailureException
        )

    let (&<) lhs rhs =
        verify(fun()-> 
            if lhs |> isLessThan rhs then 
                null
            else
                createFailureFrom "LHS should be less than RHS."
                |> addLabelledValues ("LHS", lhs)("RHS", rhs)
                |> toFailureException
        )

    let (&<=) lhs rhs =
        verify(fun()-> 
            if lhs |> isLessThanOrEqualTo rhs then 
                null
            else
                createFailureFrom "LHS should be less than or equal to RHS."
                |> addLabelledValues ("LHS", lhs)("RHS", rhs)
                |> toFailureException
        )
        
    let (&<>) lhs rhs =
        verify(fun()-> 
            if lhs |> equals rhs then 
                createFailureFrom "Did not expect values to be equal."
                |> addLabelledValues ("LHS", lhs)("RHS", rhs)
                |> toFailureException
            else
                null
        )

